package org.scboy.coobi;

import org.scboy.coobi.sql.Coobi;
import org.scboy.coobi.sql.factory.EntityFactory;
import org.scboy.coobi.init.DbInit;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@AutoConfigureAfter(value = {Coobi.class,EntityFactory.class})
public class DbAutoConfiguration {
	
	/**
	 * 首次启动初始化数据库表
	 * @return
	 */
    @Bean
    @ConditionalOnMissingBean(DbInit.class)
    @ConditionalOnBean(Coobi.class)
    public DbInit addDbInit() {
    	DbInit dbInit=new DbInit();
    	return dbInit;
    }
}
